import request from '@/utils/request'

//  调新闻推荐列表接口
export const getArticle = (params) => request({
    url: '/v1_0/articles',
    params
})

// 封装调用获取文章详情数据的接口函数
export const getArticleDetail = (id) => request({
    url: `/v1_0/articles/${id}`
})

// 封装收藏文章的接口
export const addCollect = (target) => request({
    method: 'POST',
    data: {
        target
    },
    url: '/v1_0/article/collections'
})

// 取消收藏文章的节目口
export const deleteCollect = id => request({
    url: `/v1_0/article/collections/${id}`,
    method: 'DELETE',
})


// 文章点赞接口
export const addLike = (target) => request({
    url: '/v1_0/article/likings',
    method: 'POST',
    data: {
        target
    }
})

// 取消点赞接口
export const deleteLike = id => request({
    url: `/v1_0/article/likings/${id}`,
    method: 'DELETE',
})